-
Notifications
You must be signed in to change notification settings - Fork 1
For each fun #9
Open
morga471
wants to merge
2
commits into
terraform-modules:tf-upgrade
Choose a base branch
from
morga471:for-each-fun
base: tf-upgrade
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
For each fun #9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
badra001
reviewed
Nov 4, 2024
| @@ -183,7 +184,7 @@ resource "aws_iam_role" "role" { | |||
| } | |||
|
|
|||
| resource "aws_iam_role_policy_attachment" "role" { | |||
| for_each = var.create ? toset(var.attached_policies) : toset([]) | |||
| for_each = var.create ? local.attached_policies_map : toset([]) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The false type of this has to match the true type. Change
: toset([]): {}
badra001
reviewed
Nov 4, 2024
| region = data.aws_region.current.name | ||
| account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" | ||
| account_alias = var.account_alias != "" && var.account_alias != null ? var.account_alias : "none" | ||
| attached_policies_map = { for idx, policy in var.attached_policies : idx => policy } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement will create in essence a count problem with sorting. Use it this way please:
attached_policies_map = { for p in var.attached_policies : p => p }This is also the prior behavior. Otherwise, you'll end up with a lot of resources being deleted and recreated because you're changing the key.
badra001
requested changes
Nov 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see changes
Sign in
to join this conversation on GitHub.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same idea as in terraform-modules/aws-vpc-setup#19